﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace EncodeAndEncrypt
{
    class EncodeAndEncrypt
    {
        static void Main(string[] args)
        {
            string message = Console.ReadLine();
            string cypher = Console.ReadLine();
            int encryptedLength = message.Length > cypher.Length ? message.Length : cypher.Length;
            StringBuilder encryptedMessage = new StringBuilder(message);
            for (int i = 0; i < encryptedLength; i++)
            {
                int messageChar = ((int)encryptedMessage.ToString()[i % message.Length]) - 65;
                int cypherChar = ((int)cypher[i % cypher.Length]) - 65;
                encryptedMessage.Remove(i%encryptedMessage.Length, 1);
                encryptedMessage.Insert(i % (encryptedMessage.Length+1), (char)((messageChar ^ cypherChar) + 65));
            }
            //encryptedMessage.Append(cypher);
            string messageToEncode = encryptedMessage.ToString() + cypher;
            Regex regex = new Regex(@"(.)\1+");
            StringBuilder result = new StringBuilder();
            char currentChar = messageToEncode[0];
            int counter = 0;
            for (int i = 0; i <= messageToEncode.Length; i++)
            {
                
                if (i < messageToEncode.Length && messageToEncode[i] == currentChar)
                {
                    counter++;
                }
                else
                {
                    if (counter>2)
                    {
                        result.Append(counter);
                        result.Append(currentChar);
                    }
                    else
                    {
                        result.Append(new string(currentChar, counter));
                    }
                    if (i< messageToEncode.Length)
                    {
                        currentChar = messageToEncode[i];
                        counter = 1;    
                    }
                }
            }
            result.Append(cypher.Length);
            Console.WriteLine(result);
        }
    }
}
